/*
 * @Author: xiehangyun 
 * @Date: 2025-05-16 10:34:03 
 * @Last Modified by: xiehangyun
 * @Last Modified time: 2025-05-16 21:41:56
 */

import Api from "src/api/Api";

export interface ImageItem {
    id: string;
    imageUrl: string;
    name: string;
    date: string;
}

export interface ImageListResponse {
    list: ImageItem[];
    total: number;
}

// 我的图库接口
class MyImageApi extends Api {

    constructor() {
        super()
    }

    // 获取图片列表
    getImageList(params: { page: number; pageSize: number }): Promise<{ data: ImageListResponse }> {
        return this._get('/api/image/list', params);
    }

    // 删除图片
    deleteImage(id: string): Promise<{ data: null }> {
        return this._get(`/api/image/${id}`);
    }

    // 上传图片
    uploadImage(data: FormData): Promise<{ data: ImageItem }> {
        return this._post('/api/image/upload', data);
    }
}

const myImageApi = new MyImageApi();

export default myImageApi;